package org.eerbaar.lang.expressions;

import org.eerbaar.lang.Expression;
import org.eerbaar.lang.HasRuntime;
import org.eerbaar.lang.Values;
import org.eerbaar.lang.runtime.Executor;

public class Print implements Expression, HasRuntime {

    private Expression expression = Values.UNDEF;

    public Print() {
        //
    }

    public Print(Expression expression) {
        this.expression = expression;
    }

    public org.eerbaar.lang.runtime.Runtime getRuntime() {

        return new org.eerbaar.lang.runtime.Runtime() {

            @Override
            public void execute(Executor exec) {
                System.out.println(expression);
            }

            @Override
            public Object getResult() {
                return expression;
            }
        };
    }

}
